package cn.liujianbo.easycode.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@EnableOpenApi
@Configuration
public class Knife4jConfig {


    @Bean(value = "test")
    public Docket test() {
        return new Docket(DocumentationType.OAS_30)
                .apiInfo(apiInfo())
                .groupName("test接口")
                .select()
                .apis(RequestHandlerSelectors.basePackage("cn.liujianbo.easycode.controller"))
                .build()
                ;
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("test项目")
                .description("接口文档")
                .termsOfServiceUrl("http://www.baidu.com")
                .contact(new Contact("刘建波", "http://www.qq.com", "853393090@qq.com"))
                .version("1.0")
                .build();
    }

}
